Decouple impl->current_folder from the selection in the folder tree. This
authorFederico Mena Quintero <federico@ximian.com>
Tue, 2 Dec 2003 04:23:06 +0000 (04:23 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Tue, 2 Dec 2003 04:23:06 +0000 (04:23 +0000)
2003-12-01  Federico Mena Quintero  <federico@ximian.com>

Decouple impl->current_folder from the selection in the folder
tree.  This is so that going to /home/federico/.foo (e.g. from a
bookmark) will work even if show_hidden == FALSE.  The folder tree
needs to be fixed in this case to show such folders explicitly.

* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_set_current_folder): When changing
folders, do the entry and list model work here, instead of
tree_selection_changed().
(struct _GtkFileChooserDefault): Added a changing_folder flag
again, dum de dum.
(tree_selection_changed): Use _gtk_file_chooser_set_current_folder_path().

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilechooserdefault.c

index ac6cee50dde734517e2b99b7f11da5f2e6eb4cae..f7074d62f0c7a60da6212cf646871630590194e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2003-12-01  Federico Mena Quintero  <federico@ximian.com>
+
+       Decouple impl->current_folder from the selection in the folder
+       tree.  This is so that going to /home/federico/.foo (e.g. from a
+       bookmark) will work even if show_hidden == FALSE.  The folder tree
+       needs to be fixed in this case to show such folders explicitly.
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_set_current_folder): When changing
+       folders, do the entry and list model work here, instead of
+       tree_selection_changed().
+       (struct _GtkFileChooserDefault): Added a changing_folder flag
+       again, dum de dum.
+       (tree_selection_changed): Use _gtk_file_chooser_set_current_folder_path().
+
 Tue Dec  2 01:01:54 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkiconfactory.h: Remove duplicate declaration of 
index ac6cee50dde734517e2b99b7f11da5f2e6eb4cae..f7074d62f0c7a60da6212cf646871630590194e8 100644 (file)
@@ -1,3 +1,18 @@
+2003-12-01  Federico Mena Quintero  <federico@ximian.com>
+
+       Decouple impl->current_folder from the selection in the folder
+       tree.  This is so that going to /home/federico/.foo (e.g. from a
+       bookmark) will work even if show_hidden == FALSE.  The folder tree
+       needs to be fixed in this case to show such folders explicitly.
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_set_current_folder): When changing
+       folders, do the entry and list model work here, instead of
+       tree_selection_changed().
+       (struct _GtkFileChooserDefault): Added a changing_folder flag
+       again, dum de dum.
+       (tree_selection_changed): Use _gtk_file_chooser_set_current_folder_path().
+
 Tue Dec  2 01:01:54 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkiconfactory.h: Remove duplicate declaration of 
index ac6cee50dde734517e2b99b7f11da5f2e6eb4cae..f7074d62f0c7a60da6212cf646871630590194e8 100644 (file)
@@ -1,3 +1,18 @@
+2003-12-01  Federico Mena Quintero  <federico@ximian.com>
+
+       Decouple impl->current_folder from the selection in the folder
+       tree.  This is so that going to /home/federico/.foo (e.g. from a
+       bookmark) will work even if show_hidden == FALSE.  The folder tree
+       needs to be fixed in this case to show such folders explicitly.
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_set_current_folder): When changing
+       folders, do the entry and list model work here, instead of
+       tree_selection_changed().
+       (struct _GtkFileChooserDefault): Added a changing_folder flag
+       again, dum de dum.
+       (tree_selection_changed): Use _gtk_file_chooser_set_current_folder_path().
+
 Tue Dec  2 01:01:54 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkiconfactory.h: Remove duplicate declaration of 
index ac6cee50dde734517e2b99b7f11da5f2e6eb4cae..f7074d62f0c7a60da6212cf646871630590194e8 100644 (file)
@@ -1,3 +1,18 @@
+2003-12-01  Federico Mena Quintero  <federico@ximian.com>
+
+       Decouple impl->current_folder from the selection in the folder
+       tree.  This is so that going to /home/federico/.foo (e.g. from a
+       bookmark) will work even if show_hidden == FALSE.  The folder tree
+       needs to be fixed in this case to show such folders explicitly.
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_set_current_folder): When changing
+       folders, do the entry and list model work here, instead of
+       tree_selection_changed().
+       (struct _GtkFileChooserDefault): Added a changing_folder flag
+       again, dum de dum.
+       (tree_selection_changed): Use _gtk_file_chooser_set_current_folder_path().
+
 Tue Dec  2 01:01:54 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkiconfactory.h: Remove duplicate declaration of 
index ac6cee50dde734517e2b99b7f11da5f2e6eb4cae..f7074d62f0c7a60da6212cf646871630590194e8 100644 (file)
@@ -1,3 +1,18 @@
+2003-12-01  Federico Mena Quintero  <federico@ximian.com>
+
+       Decouple impl->current_folder from the selection in the folder
+       tree.  This is so that going to /home/federico/.foo (e.g. from a
+       bookmark) will work even if show_hidden == FALSE.  The folder tree
+       needs to be fixed in this case to show such folders explicitly.
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_set_current_folder): When changing
+       folders, do the entry and list model work here, instead of
+       tree_selection_changed().
+       (struct _GtkFileChooserDefault): Added a changing_folder flag
+       again, dum de dum.
+       (tree_selection_changed): Use _gtk_file_chooser_set_current_folder_path().
+
 Tue Dec  2 01:01:54 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkiconfactory.h: Remove duplicate declaration of 
index a49d40889e3b918d6b57149b29b90ca1b1e4c900..97531291437c83199596130b2060d9f5af3ed001 100644 (file)
@@ -120,6 +120,7 @@ struct _GtkFileChooserDefault
   guint show_hidden : 1;
   guint list_sort_ascending : 1;
   guint bookmarks_set : 1;
+  guint changing_folder : 1;
 };
 
 /* Column numbers for the shortcuts tree.  Keep these in sync with create_shortcuts_model() */
@@ -1810,8 +1811,40 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser    *chooser,
 {
   GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
 
-  _gtk_file_system_model_path_do (impl->tree_model, path,
-                                 expand_and_select_func, impl);
+  if (impl->current_folder)
+    gtk_file_path_free (impl->current_folder);
+
+  impl->current_folder = gtk_file_path_copy (path);
+
+  /* Notify the folder tree */
+
+  if (!impl->changing_folder)
+    {
+      impl->changing_folder = TRUE;
+      _gtk_file_system_model_path_do (impl->tree_model, path,
+                                     expand_and_select_func, impl);
+      impl->changing_folder = FALSE;
+    }
+
+  /* Notify the location entry */
+
+  _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->entry), impl->current_folder);
+
+  /* Create a new list model */
+  set_list_model (impl);
+
+  /* Refresh controls */
+
+  shortcuts_unselect_all (impl);
+  toolbar_check_sensitivity (impl);
+
+  g_signal_emit_by_name (impl, "current-folder-changed", 0);
+
+  update_chooser_entry (impl);
+  check_preview_change (impl);
+  bookmarks_check_add_sensitivity (impl);
+
+  g_signal_emit_by_name (impl, "selection-changed", 0);
 }
 
 static GtkFilePath *
@@ -2328,11 +2361,6 @@ tree_selection_changed (GtkTreeSelection      *selection,
   if (impl->current_folder && gtk_file_path_compare (file_path, impl->current_folder) == 0)
     return;
 
-  if (impl->current_folder)
-    gtk_file_path_free (impl->current_folder);
-  impl->current_folder = gtk_file_path_copy (file_path);
-  _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->entry), file_path);
-
   /* Close the tree up to only the parents of the newly selected
    * node and it's immediate children are visible.
    */
@@ -2340,19 +2368,8 @@ tree_selection_changed (GtkTreeSelection      *selection,
   open_and_close (GTK_TREE_VIEW (impl->tree), path);
   gtk_tree_path_free (path);
 
-  /* Create the new list model */
-  set_list_model (impl);
-
-  shortcuts_unselect_all (impl);
-  toolbar_check_sensitivity (impl);
-
-  g_signal_emit_by_name (impl, "current-folder-changed", 0);
-
-  update_chooser_entry (impl);
-  check_preview_change (impl);
-  bookmarks_check_add_sensitivity (impl);
-
-  g_signal_emit_by_name (impl, "selection-changed", 0);
+  if (!impl->changing_folder)
+    _gtk_file_chooser_set_current_folder_path (GTK_FILE_CHOOSER (impl), file_path);
 }
 
 /* Callback used when a row in the shortcuts list is activated */